package edu.nanyang.struts;

import java.util.List;

import org.apache.struts2.json.annotations.JSON;

import com.opensymphony.xwork2.ActionSupport;

import edu.nanyang.domain.User;
import edu.nanyang.hibernate.ManageUser;

@SuppressWarnings("serial")
public class ManageUserAction extends ActionSupport{
	private ManageUser manageuser;
	private List<User> users;
	private int userid;
	private String username;
	private User user;

	
	
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public int getUserid() {
		return userid;
	}
	public void setUserid(int userid) {
		this.userid = userid;
	}
	@JSON(serialize=false)
	public ManageUser getManageuser() {
		return manageuser;
	}
	public void setManageuser(ManageUser manageuser) {
		this.manageuser = manageuser;
	}
	public List<User> getUsers() {
		return users;
	}
	public String selectuser(){
		this.users=manageuser.selectuser();
		return SUCCESS;	
	}
	public String deletetuser(){
		manageuser.deleteuser(userid);
		return SUCCESS;	
		
	}

	public String selectuserbyname(){
		user=manageuser.selectuserbyname(username);
		username=user.getUsername();
		
		return SUCCESS;	
		
	}
	

}
